#include "StompedReality/Core/MessageSystem/Message.h"
#include "StompedReality/Core/MessageSystem/MessageTypes.h"
#include "StompedReality/Math/Vector2.h"
#include <UnitTest++.h>
static const StompedReality::ID NEW_OBJECT_ID_ADD = 0x10000;
SUITE( Message_Tests )
{
  TEST( Camera_Movement_Test_Get )
  {
    StompedReality::Core::Message msg(
      StompedReality::Core::CAMERA_MOVEMENT, 0, 10,
      sizeof(StompedReality::Math::Vector2) + sizeof(int) );
    msg.SetData<StompedReality::Math::Vector2>( 0,
                                                StompedReality::Math::Vector2( 5, 1 ) );
    msg.SetData<int>( sizeof(StompedReality::Math::Vector2), -1 );
    CHECK_EQUAL( StompedReality::Core::CAMERA_MOVEMENT,
                 msg.GetMessageType( ) );
    CHECK_EQUAL( 0, msg.GetSenderID( ) );
    CHECK_EQUAL( 10, msg.GetSenderType( ) );
    CHECK_EQUAL( 5, msg.GetData<StompedReality::Math::Vector2>( 0 ).GetX( ) );
    CHECK_EQUAL( 1, msg.GetData<StompedReality::Math::Vector2>( 0 ).GetY( ) );
    CHECK_EQUAL( -1, msg.GetData<int>( sizeof(StompedReality::Math::Vector2) ) );
  }
  TEST( Camera_Movement_Test_Iter )
  {
    StompedReality::Core::Message msg(
      StompedReality::Core::CAMERA_MOVEMENT, 0, 10,
      sizeof(StompedReality::Math::Vector2) + sizeof(int)  );
    msg.SetData<StompedReality::Math::Vector2>( 0,
                                                StompedReality::Math::Vector2( 5, 1 ) );
    msg.SetData<int>( sizeof(StompedReality::Math::Vector2), -1 );
    CHECK_EQUAL( StompedReality::Core::CAMERA_MOVEMENT,
                 msg.GetMessageType( ) );
    CHECK_EQUAL( 0, msg.GetSenderID( ) );
    CHECK_EQUAL( 10, msg.GetSenderType( ) );
    msg.BeginIteration( );
    CHECK_EQUAL( true, msg.HasMore( ) );
    StompedReality::Math::Vector2 val = msg.Next<StompedReality::Math::Vector2>( );
    CHECK_EQUAL( 5, val.GetX( ) );
    CHECK_EQUAL( 1, val.GetY( ) );
    CHECK_EQUAL( true, msg.HasMore( ) );
    CHECK_EQUAL( -1, msg.Next<int>( ) );
  }
}